form.addEventListener("submit", function (event) {
    // 用户名验证
    let Benchmark = true;
    let reg = /^.{3,20}$/;


    if (!reg.test(user.value) || user.value == '') {
        user.style.border = '1px solid red'
        Benchmark = false;
    } else {
        user.style.border = '1px solid green'
    }
    // 手机号验证
    let regA = /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
    if (!regA.test(phone.value) || phone.value == '') {
        phone.style.border = '1px solid red'
        Benchmark = false;
    } else {
        phone.style.border = '1px solid green'
        //验证码
        let Captcha = document.querySelector('#Captcha');
        console.log(Captcha);
        //点击禁用
        disabled = true;
        let time = 10;
        //倒计时设置
        let timeId = setInterval(function () {
            //倒计时
            time--;
            console.log(time);
            //清除复原设置
            if (time <= 0) {
                clearInterval(timeId)
                Captcha.disabled = false;
                Captcha.textContent = `获取验证码`
            } else {
                Captcha.innerHTML = `获取验证码(${time}s)`

            }
        }, 1000)
    }

    // 密码
    let regB = /^[\s\S]{6,12}/;

    if (!regB.test(pwd.value) || pwd.value == '') {
        pwd.style.border = '1px solid red'
        Benchmark = false;
    } else {
        pwd.style.border = '1px solid green'
    }



    // 跳转
    // let input = document.querySelectorAll('.input');

    if (!Benchmark) {
        event.preventDefault();
    }
})

//多选框和按钮联动
document.querySelector("#checkbox").addEventListener('change', function () {
    //获取选中状态
    if (Gift.disabled = !this.checked) {
        Gift.style.background = '#dbdbdb'
        Gift.style.color = '#5c5c5c'
        Benchmark = false;
    } else {
        Gift.style.background = '#00bdff'
        Gift.style.color = '#fff'
    }
});